Skip to content

ConditionalOnClass (HateoasProperties.class) in SpringDocHateoasConfiguration#3260

Merged
bnasslahsen merged 1 commit intospringdoc:spring-boot-4from
seregamorph:SpringDocHateoasConfiguration-class-not-found-exception
Apr 11, 2026
Merged

ConditionalOnClass (HateoasProperties.class) in SpringDocHateoasConfiguration#3260
bnasslahsen merged 1 commit intospringdoc:spring-boot-4from
seregamorph:SpringDocHateoasConfiguration-class-not-found-exception

Conversation

@seregamorph
Copy link
Copy Markdown

@seregamorph seregamorph commented Apr 11, 2026

Problem statement

SpringDocHateoasConfiguration auto-configurations fails in case of combination when org.springframework.hateoas:spring-hateoas is present in the classpath (checked via existing @ConditionalOnClass(LinkRelationProvider.class)), but org.springframework.boot.hateoas.autoconfigure.HateoasProperties from org.springframework.boot:spring-boot-hateoas (since 4.0.x) is not on the classpath.

The failure is

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'hateoasHalProvider' defined in class path resource [org/springdoc/core/configuration/SpringDocHateoasConfiguration.class]: 
Unexpected exception during bean creation
...
Caused by: java.lang.TypeNotPresentException: Type org.springframework.boot.hateoas.autoconfigure.HateoasProperties not present
...
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.hateoas.autoconfigure.HateoasProperties

Proposed solution

Add missing @ConditionalOnClass(HateoasProperties.class)

@bnasslahsen bnasslahsen merged commit 4d1a730 into springdoc:spring-boot-4 Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants